import fetch from 'node-fetch';

async function testPublishArticle() {
    try {
        console.log('Testing article publish API...');
        
        const response = await fetch('http://localhost:8000/api/v1/admin/article/publish', {
            method: 'POST',
            headers: {
                'Authorization': 'Bearer admin_token',
                'Content-Type': 'application/json'
            },
            body: JSON.stringify({
                title: '测试文章标题',
                content: '这是一篇测试文章的完整内容，用于验证发布功能是否正常工作。',
                categoryId: 1,
                date: '2025-08-15',
                state: '已发布'
            })
        });
        
        console.log('Response status:', response.status);
        const text = await response.text();
        console.log('Response body:', text);
        
    } catch (error) {
        console.error('Error:', error);
    }
}

testPublishArticle();
